import { defineStore } from "pinia";
import piniaPersistConfig from "@/stores/helper/persist";

export const useUserStore = defineStore({
  id: "geeker-user",
  state: () => ({
    // token值
    token: "",
    // 员工名称
    userInfo: { name: "Geeker" },
    // 员工身份
    userdepartment:"",
    // 员工账号
    username:"",
    // 员工密码
    password:"",
    // 消息
    activeList:[],
  }),
  getters: {},
  actions: {
    setActiveList(user) {
      this.activeList = user;
    },
    // Set Token
    setToken(token) {
      this.token = token;
    },
    setUserdepartment(user) {
      this.userdepartment = user;
    },
    setUsername(user) {
      this.username = user;
    },
    setPassword(user) {
      this.password = user;
    },
    // Set setUserInfo
    setUserInfo(userInfo) {
      console.log(userInfo);
      
      this.userInfo.name = userInfo;
    }
  },
  persist: piniaPersistConfig("geeker-user")
});
